/**
  ******************************************************************************
  * @file    User/user.c
  * @author  JUSHENG Application Team
  * @version V1.0.4
  * @date    12-14-2021
  * @brief   Main program body
  ******************************************************************************
  * @attention
  *
  * <h2><center>&copy; COPYRIGHT 2021 JUSHENG</center></h2>
  *
  *
  ******************************************************************************
  */ 

/* Includes ------------------------------------------------------------------*/
#include "include.h"
#include "user.h"
#include "tk_cfg.h"

/** @addtogroup Template_Project
  * @{
  */

/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
void timer_init(void)
{
    TYPE_LL_GPIO_INIT gpio_init_cfg;
    memset(&gpio_init_cfg, 0x0, sizeof(gpio_init_cfg));
    gpio_init_cfg.gpio_mode = LL_GPIO_MODE_AF;
    gpio_init_cfg.gpio_pin  = LL_GPIO_PIN_6;
    ll_gpio_init(GPIOA, &gpio_init_cfg);
    ll_gpio_pin_af_config(GPIOA, LL_GPIO_PIN_SOURCE_6, LL_GPIO_AF_1);
    
    TYPE_LL_TIMER_INIT timer_cfg;
    memset(&timer_cfg, 0x0, sizeof(timer_cfg));
    timer_cfg.prescaler = LL_TIMER_PSC_NONE;
    timer_cfg.timer_src_sel = LL_TIMER_SRC_SYS_RISING;
    ll_timer_init(TIMER0, &timer_cfg);
    
    
    TYPE_LL_TIMER_PWM_CFG pwm_cfg;
    memset(&pwm_cfg, 0x0, sizeof(pwm_cfg));
    pwm_cfg.pwm_duty = 6000;
    pwm_cfg.pwm_period = 12000;
    ll_timer_pwm_mode_config(TIMER0, &pwm_cfg);
                       
    ll_timer_pwm_start(TIMER0);    
    delay_ms(5);
}


/**
  * @}
  */

/*************************** (C) COPYRIGHT 2021 JUSHENG ***** END OF FILE *****/
